<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div
        class="list-left"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style9/exhibitionStandStyle4Bg-left.webp'})`,
        }"
      ></div>
      <div class="list-content">
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
        >
          <div class="item-flex">
            <div
              class="item-content"
              :style="{
                backgroundImage: `url(${
                  publicUrls + 'free/style9/exhibitionStandStyle4Bg.webp'
                })`,
              }"
            >
              <div class="img-bg">
                <div class="cover-box">
                  <div class="cover" @click="viewImg(item.moduleId, item.id)">
                    <img
                      v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')"
                      alt=""
                      class="exhibit-img"
                    />
                    <img
                      v-if="route.meta.loopType"
                      class="flower-btn"
                      v-lazy="publicUrls + 'free/style2/flower.webp'"
                    />
                  </div>
                </div>
              </div>
              <div class="items-title">
                <p class="items-name">{{ item.name }}</p>
              </div>
            </div>
          </div>
          <div
            class="list-center"
            :style="{
              backgroundImage: `url(${
                publicUrls + 'free/style9/exhibitionStandStyle4Bg-1.webp'
              })`,
            }"
          ></div>
        </div>
      </div>
      <div
        class="list-right"
        :style="{
          backgroundImage: `url(${
            publicUrls + 'free/style9/exhibitionStandStyle4Bg-right.webp'
          })`,
        }"
      ></div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free9Style3',
});
</script>
<script lang="ts" setup>
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick, defineComponent } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';
import { useRoute } from 'vue-router';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const route = useRoute();
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
</script>

<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  // padding: 0 0.1rem !important;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.list {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.list-left {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
}
.list-right {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
}
.list-content {
  display: flex;
  flex-shrink: 0;
  min-width: 244px;
  height: 670px;
}
.exhibits-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: auto;
  height: 670px;
}
.item-flex {
  display: flex;
  flex-direction: column;
  width: 244px;
  height: 620px;
  margin: 0 10px;
}
.item-content {
  display: flex;
  flex-direction: column;
  width: 244px;
  height: 620px;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  padding: 65px 34px 0 30px;
}
.list-center {
  min-width: 100%;
  height: 50px;
  background-repeat: repeat !important;
  background-size: 100% 100% !important;
}
.img-bg {
  width: 180px;
  height: 240px;
  background-repeat: no-repeat !important;
  background-size: 100% 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-box {
  width: 180px;
  height: 240px;
}
.cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: all 0.3s;
  overflow: hidden;
  .exhibit-img {
    width: 100%;
    height: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: all 0.3s;
  }
}
.cover-box:hover {
  .cover .exhibit-img {
    transform: scale(1.2);
  }
}
.flower-btn {
  width: 50px !important;
  height: 50px !important;
  object-fit: cover !important;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: flower 2s linear infinite;
  @keyframes flower {
    0% {
      opacity: 0;
    }
    40% {
      opacity: 100%;
    }
    60% {
      opacity: 100%;
    }
    100% {
      opacity: 0;
    }
  }
}
.items-title {
  display: flex;
  margin-top: 8px;
  width: 173px;
  height: 24px;
  margin-left: 6px;
}
.items-name {
  width: 173px;
  height: 24px;
  font-family: PingFang SC, PingFang SC;
  font-weight: 400;
  font-size: 16px;
  color: #333333;
  line-height: 24px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
